feat(2403): wire up learn page#2446
Conversation
herzog0
left a comment
There was a problem hiding this comment.
Hey Cristian, all good from my end, just a couple of comments that you should be aware of!
| kwargs={ | ||
| "version_slug": LATEST_RELEASE_URL_PATH_STR, | ||
| "library_view_str": "categorized", | ||
| "category_slug": category.slug, |
There was a problem hiding this comment.
If @julhoang's PR merges first I could adjust it here, or in a follow-up ticket, whatever's best 👍
| <div class="item-a"> | ||
| {% with data=post_cards_data %} | ||
| {% include 'v3/includes/_post_cards_v3.html' with heading=data.heading posts=data.posts view_all_url=data.view_all_url view_all_label=data.view_all_label theme='teal' variant="content-card" %} | ||
| {% include 'v3/includes/_post_card.html' with heading=data.heading items=data.posts variant="card" theme="teal" layout="vertical" primary_cta_label=data.view_all_label primary_cta_url=data.view_all_url %} |
There was a problem hiding this comment.
Just a heads up that this will conflict with @jlchilders11's pr #2414.
In his PR he also fixes the designs of the boost community card, so QA must be aware that you're tackling this in your PR, if it moves to QA before Jeremy's one gets merged.
There was a problem hiding this comment.
Thanks for the heads up, I noticed so I'm counting on it merging first and me rebasing over the last changes 👍
Adopts the _community_card.html component from PR #2414 for the 'Boost community' section of the Learn page (replacing _join_card.html), along with its supporting CSS rewrite (learn-page.css cleanup, new community-card.css) and the registration in components.css. Renames boost_community_data item 'url' -> 'cta_url' to match the new component's expected shape.
julhoang
left a comment
There was a problem hiding this comment.
Hi @ycanales ! Thank you for setting up the shared helper for querying the latest posts, and I love the handy Wagtail snippet for the categories too! Definitely makes it much easier to manage that content than clicking through that the admin panel – speaking of which, would you mind raising to Glauber & Rob that we need content support to populate the new description of the categories?
| ctx["learn_card_data"] = [ | ||
| { | ||
| "title": "I want to learn:", | ||
| "text": "How to install Boost, use its libraries, build projects, and get help when you need it.", | ||
| "text": ( | ||
| "How to install Boost, use its libraries, build projects, " | ||
| "and get help when you need it." | ||
| ), | ||
| "links": [ | ||
| { | ||
| "label": "Explore common use cases", | ||
| "url": "https://www.example.com", | ||
| "url": "https://www.boost.org/doc/user-guide/common-introduction.html", | ||
| }, | ||
| { | ||
| "label": "Build with CMake", | ||
| "url": "https://www.boost.org/doc/user-guide/building-with-cmake.html", | ||
| }, | ||
| { | ||
| "label": "Visit the FAQ", | ||
| "url": "https://www.boost.org/doc/user-guide/faq.html", | ||
| }, | ||
| {"label": "Build with CMake", "url": "https://www.example.com"}, | ||
| {"label": "Visit the FAQ", "url": "https://www.example.com"}, | ||
| ], | ||
| "url": "https://www.example.com", | ||
| "label": "Learn more about Boost", | ||
| "url": "https://www.boost.org/doc/user-guide/getting-started.html", | ||
| "label": "Get started with Boost", | ||
| "image_src": large_static("/img/v3/learn-page/learn-cheetah.png"), | ||
| "mobile_image_src": large_static( | ||
| "/img/v3/learn-page/cheetah-mobile.png" | ||
| ), | ||
| }, | ||
| { | ||
| "title": "I want to learn:", | ||
| "text": "How to install Boost, use its libraries, build projects, and get help when you need it.", | ||
| "title": "I want to contribute:", | ||
| "text": ( | ||
| "How to contribute to Boost, propose new libraries, " | ||
| "and engage in formal reviews." | ||
| ), | ||
| "links": [ | ||
| { | ||
| "label": "Explore common use cases", | ||
| "url": "https://www.example.com", | ||
| "label": "Contribute to an existing library", | ||
| "url": "https://www.boost.org/doc/contributor-guide/contributors-faq.html", | ||
| }, | ||
| { | ||
| "label": "Learn about formal reviews", | ||
| "url": "https://www.boost.org/doc/formal-reviews/submissions.html", | ||
| }, | ||
| { | ||
| "label": "Visit the Contributors FAQ", | ||
| "url": "https://www.boost.org/doc/contributor-guide/contributors-faq.html", | ||
| }, | ||
| {"label": "Build with CMake", "url": "https://www.example.com"}, | ||
| {"label": "Visit the FAQ", "url": "https://www.example.com"}, | ||
| ], | ||
| "url": "https://www.example.com", | ||
| "label": "Learn more about Boost", | ||
| "image_src": large_static("img/v3/learn-page/learn-octopus.png"), | ||
| "url": "https://www.boost.org/doc/contributor-guide/requirements/library-requirements.html", | ||
| "label": "Propose a new library", | ||
| "image_src": large_static("/img/v3/learn-page/learn-octopus.png"), | ||
| "mobile_image_src": large_static( | ||
| "/img/v3/learn-page/octopus-mobile.png" | ||
| ), | ||
| }, | ||
| ] |
There was a problem hiding this comment.
All of these data are static – can we consider having the page HTML template hardcode these instead of serving these through context? 🤔 I think it'd be better to have the BE just provide dynamic data. Please consider updating the other ctx as well (e.g. ctx["why_boost_cards"], ctx["info_card"], ctx["boost_community_data"] , etc)
| # Copy mirrors the Figma frame at node 1849:49695. The design currently | ||
| # has two cards titled "Modern approach to C++" — flagged to design. |
There was a problem hiding this comment.
Can we follow up with design and remove this comment from code? 🙏
| Entry.objects.published() | ||
| .select_related("author") | ||
| .order_by("-publish_at")[:limit] |
There was a problem hiding this comment.
Would you mind adding .filter(deleted_at__isnull=True) here to filter out non-deleted post here?
| Category.objects.annotate(library_count=Count("libraries", distinct=True)) | ||
| .filter(library_count__gt=0) | ||
| .only("name", "slug", "short_description") |
There was a problem hiding this comment.
Nice catch! Adjusted.
| author.get_avatar_url() if hasattr(author, "get_avatar_url") else "" | ||
| ), | ||
| "badge_url": None, | ||
| "show_badge": False, |
There was a problem hiding this comment.
hmm it seems like this show_badge isn't used anywhere and we probably don't need it at all – 🪓?
There was a problem hiding this comment.
Totally right, adjusted, thanks!
| <div class="item-b"> | ||
| {% with data=boost_community_data %} | ||
| {% include 'v3/includes/_community_card.html' with heading=data.heading items=data.posts primary_cta_url=data.view_all_url primary_cta_label=data.view_all_label %} | ||
| {% include 'v3/includes/_community_card.html' with heading=data.heading items=data.items variant="card" theme="default" layout="vertical" primary_cta_label=data.primary_cta_label primary_cta_url=data.primary_cta_url %} |
There was a problem hiding this comment.
This variant should be list and we can remove the theme and layout
There was a problem hiding this comment.
Good catch, I've fixed it, thanks!
| "links": [ | ||
| { | ||
| "label": "Explore common use cases", | ||
| "url": "https://www.example.com", | ||
| "url": "https://www.boost.org/doc/user-guide/common-introduction.html", | ||
| }, | ||
| { | ||
| "label": "Build with CMake", | ||
| "url": "https://www.boost.org/doc/user-guide/building-with-cmake.html", | ||
| }, | ||
| { | ||
| "label": "Visit the FAQ", | ||
| "url": "https://www.boost.org/doc/user-guide/faq.html", | ||
| }, | ||
| {"label": "Build with CMake", "url": "https://www.example.com"}, | ||
| {"label": "Visit the FAQ", "url": "https://www.example.com"}, | ||
| ], | ||
| "url": "https://www.example.com", | ||
| "label": "Learn more about Boost", | ||
| "url": "https://www.boost.org/doc/user-guide/getting-started.html", |
There was a problem hiding this comment.
For these internal URLs, can we make these relative paths instead of hardcoded boost.org? Please update the other URLs on this page as well 🙏
There was a problem hiding this comment.
Good catch, adjusted!
| class CategorySnippetViewSet(SnippetViewSet): | ||
| model = Category | ||
| menu_label = "Library Categories" | ||
| icon = "tag" | ||
| list_display = ["name", "short_description"] | ||
| search_fields = ["name", "short_description"] | ||
| panels = [ | ||
| FieldPanel("name"), | ||
| FieldPanel("slug"), | ||
| FieldPanel("short_description"), | ||
| ] | ||
|
|
||
|
|
||
| register_snippet(CategorySnippetViewSet) |
jlchilders11
left a comment
There was a problem hiding this comment.
Just a general comment: This is built with the assumption that we are using Entry models, per our earlier discussion could we stub out logic for handling wagtail pages as well?
| icon = "tag" | ||
| list_display = ["name", "short_description"] | ||
| search_fields = ["name", "short_description"] | ||
| panels = [ |
There was a problem hiding this comment.
Just a note when defining panels, if you are using a FieldPanel with no customization you can also just enter the field name as a string and Wagtail will figure it out.
So you could instead have
panels = [
"name",
"slug",
"short_description"
]

Issue: #2403
Summary & Context
Changes
get_latest_post_cardsCategory.short_description: field, migration and Waftail snippet.LearnPageViewEntry-Libraryrelationship for library tags?Screenshots
Self-review Checklist
Frontend